package com.mms.utsc.smartnet;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class ScheduleActivity extends Activity implements OnClickListener {
	Button addBtn;
	Button clearBtn;
	Button genBtn;
	EditText course;
	EditText day;
	EditText start;
	EditText end;
	ArrayList<Schedule> schedule = new ArrayList<Schedule>();
	DateFormat formatter = new SimpleDateFormat("hh:mm");
	
	@Override
	protected void onCreate(Bundle savedInstatnceState) {
		super.onCreate(savedInstatnceState);
		setContentView(R.layout.add_courses);
		
		addBtn = (Button) findViewById(R.id.bAdd);
		clearBtn = (Button) findViewById(R.id.bClear);
		genBtn = (Button) findViewById(R.id.bGen);
		course = (EditText) findViewById(R.id.etCourse);
		day = (EditText) findViewById(R.id.etDay);
		start = (EditText) findViewById(R.id.etStart);
		end = (EditText) findViewById(R.id.etEnd);
		addBtn.setOnClickListener(this);
		clearBtn.setOnClickListener(this);
		genBtn.setOnClickListener(this);
	}
	
	public void onClick(View view) {
		switch (view.getId()) {
		case R.id.bAdd:
			Date _start = null;
			Date _end = null;
			String c = course.getText().toString();
			String d = day.getText().toString();
			try {
				_start = formatter.parse(start.getText().toString());
				_end = formatter.parse(end.getText().toString());
			} catch (ParseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			schedule.add(new Schedule(c,d,_start,_end));
		case R.id.bClear:
			course.setText(null);
			day.setText(null);
			start.setText(null);
			end.setText(null);
		case R.id.bGen:
			//go to generate activity
		}
		
			

	}

}
